﻿using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using EPiServer.DataAbstraction;
using NUnit.Framework;
using NUnit.Framework.SyntaxHelpers;
using EPiServer.Core;
using EPiSugar.UnitTesting;
using EPiSugar.Navigation;
using System;

namespace EPiSugar.Tests.Navigation
{
    [TestFixture]
    public class PageReferenceTests : NavigationTestsBase
    {
        [Test]
        public void CanGetParentLink_OfStartPageLink()
        {
            PageReference parentLink = PageReference.StartPage.ParentLink();
            Assert.That(parentLink, Is.EqualTo(PageReference.RootPage));
        }

        [Test]
        public void CanGetParent_OfStartPageLink()
        {
            PageData parent = PageReference.StartPage.Parent();
            Assert.That(parent, Is.EqualTo(rootPage));
        }

        [Test]
        public void CanGetChildren_OfStartPageLink()
        {
            int count = PageReference.StartPage.Children().Count;
            Assert.That(count, Is.EqualTo(3));
        }

        [Test]
        public void CanGetDescendants_OfStartPageLink()
        {
            int count = PageReference.StartPage.Descendants().Count();
            Assert.That(count, Is.EqualTo(width * width + width));
        }
    }
}